]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
environment: Mark transitions as "work"
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 3 Aug 2020 16:33:57 +0000 (18:33 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Wed, 12 Aug 2020 15:43:38 +0000 (15:43 +0000)
global.run_at_leisure() is used from automated scripts to schedule
a callback when the shell is idle. However since we moved away from
Tweener, animations are no longer taken into account; fix this by
marking transitions as "work" if the convenience ease() functions
are used.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1396

js/ui/environment.js

index 9b4ef24b14803142e24ae893f1c3ae8bea2c6279..af0300dc78eb3c964d48cff8d3113c5e48f8c2ba 100644 (file)
@@ -134,7 +134,14 @@ function _easeActor(actor, params) {
         actor.set_easing_mode(params.mode);
     delete params.mode;
 
-    let cleanup = () => Meta.enable_unredirect_for_display(global.display);
+    const prepare = () => {
+        Meta.disable_unredirect_for_display(global.display);
+        global.begin_work();
+    };
+    const cleanup = () => {
+        Meta.enable_unredirect_for_display(global.display);
+        global.end_work();
+    };
     let callback = _makeEaseCallback(params, cleanup);
 
     // cancel overwritten transitions
@@ -149,9 +156,9 @@ function _easeActor(actor, params) {
         .find(t => t !== null);
 
     if (transition && transition.delay)
-        transition.connect('started', () => Meta.disable_unredirect_for_display(global.display));
+        transition.connect('started', () => prepare());
     else
-        Meta.disable_unredirect_for_display(global.display);
+        prepare();
 
     if (transition) {
         transition.set({ repeatCount, autoReverse });
@@ -191,7 +198,14 @@ function _easeActorProperty(actor, propName, target, params) {
     if (actor instanceof Clutter.Actor && !actor.mapped)
         duration = 0;
 
-    let cleanup = () => Meta.enable_unredirect_for_display(global.display);
+    const prepare = () => {
+        Meta.disable_unredirect_for_display(global.display);
+        global.begin_work();
+    };
+    const cleanup = () => {
+        Meta.enable_unredirect_for_display(global.display);
+        global.end_work();
+    };
     let callback = _makeEaseCallback(params, cleanup);
 
     // cancel overwritten transition
@@ -203,7 +217,7 @@ function _easeActorProperty(actor, propName, target, params) {
         if (!isReversed)
             obj[prop] = target;
 
-        Meta.disable_unredirect_for_display(global.display);
+        prepare();
         callback(true);
 
         return;
@@ -222,9 +236,9 @@ function _easeActorProperty(actor, propName, target, params) {
     transition.set_to(target);
 
     if (transition.delay)
-        transition.connect('started', () => Meta.disable_unredirect_for_display(global.display));
+        transition.connect('started', () => prepare());
     else
-        Meta.disable_unredirect_for_display(global.display);
+        prepare();
 
     transition.connect('stopped', (t, finished) => callback(finished));
 }